package com.iteye.weimingtom.cimmod;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class AdminServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private static final Logger logger = LoggerFactory.getLogger(AdminServlet.class);
	
    public AdminServlet() {
        super();
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String act = request.getParameter("act");
		if (act == null || act.equals("")) {
			
		} else if (act.equals("list")) {
//			request.setAttribute("sessionList", GlobalContext.getDefaultSessionManager().queryAll());
			request.setAttribute("sessionList", TokenManager.getInstance().tokenList);
			request.getRequestDispatcher("console/session/manage.jsp").forward(request, response);
		} else if (act.equals("offline")) {
//			 String account = ServletActionContext.getRequest().getParameter("account");
//			  Message msg = new Message();
//			  msg.setType("999");//强行下线消息类型
//			  msg.setReceiver(account);
//			  
//			 //向客户端 发送消息
//		     ContextHolder.getBean(SystemMessagePusher.class).push(msg);
		}
	}

}
